import request from '/@/utils/request';

/**
 * 登录api接口集合
 * @method signIn 用户登录
 */
export function login(params: object){
	return request({
		url: '/system/login',
		method: 'post',
		data: params,
	});
}

/**
 * 获取验证码
 */
export function captcha(){
	return request({
		url:"/pub/captcha/get",
		method:"get"
	})
}

/**
 * 清除缓存
 */
 export function cacheOut(){
	return request({
		url: '/system/user/clearCache',
		method: 'post'
	});
}

/**
 * 退出登录
 */
export function signOut(params: object){
	return request({
		url: '/user/signOut',
		method: 'post',
		data: params,
	});
}
import * as dd from 'dingtalk-jsapi';
import { ElMessage } from 'element-plus';
import {randomString} from "/@/utils/ruoyi";

export function getCode(corp: any,callback:any) {

	if (dd.env.platform !== "notInDingTalk"&&corp.type==='dingtalk') {
		dd.ready(() => {
			//使用SDK 获取免登授权码
			dd.runtime.permission.requestAuthCode({
				corpId: corp.corpId
			}).then((info:any)=>{
				callback(info.code,corp.type)
			}).catch(reason=>{
				ElMessage.error(corp.corpID+reason.errorMessage)
			});
		});
	}
}
function getQueryString(name:string) {
	let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
	let r = window.location.search.match(reg);
	if (r != null) {
		return r[2];
	}
	return null;
}
export function getDingTalksCheck() {
	return dd.env.platform !== "notInDingTalk";
}
export function AutoLogin(code:string,type:string) {
	return request({
		url: '/system/autologin',
		method: 'post',
		data: { code:code,type:type }
	})
}
// 呆滞品
export function postdzp(pageNum:string,pageSize:string,mname:any,mcode:any) {
	return request({
		url: '/system/latandlong/sraechlk234',
		method: 'post',
		data: { page:pageNum,size:pageSize,mname:mname,mcode:mcode }
	})
}